From 8c50bb1bdbf3f2755366c825d540b4671c074e8f Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Fri, 8 Sep 2023 17:06:32 -0600 Subject: [PATCH] Apply new resharper refactoring "Redundant dereferencing and taking address" --- geojson.cc | 2 +- googletakeout.cc | 6 +++--- jeeps/gpsread.cc | 20 ++++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/geojson.cc b/geojson.cc index 1c914dcdf..6c5e60c51 100644 --- a/geojson.cc +++ b/geojson.cc @@ -249,7 +249,7 @@ void GeoJsonFormat::geojson_track_disp(const Waypoint* trackpoint) const if (trackpoint->altitude != unknown_alt && trackpoint->altitude != 0) { coords.append(trackpoint->altitude); } - (*track_coords).append(coords); + track_coords->append(coords); } void GeoJsonFormat::geojson_track_tlr(const route_head* /*unused*/) diff --git a/googletakeout.cc b/googletakeout.cc index a962aa49c..d4b82f882 100644 --- a/googletakeout.cc +++ b/googletakeout.cc @@ -68,13 +68,13 @@ static Waypoint* takeout_waypoint( Waypoint* waypoint = new Waypoint(); waypoint->latitude = lat_e7 / 1e7; waypoint->longitude = lon_e7 / 1e7; - if (shortname && (*shortname).length() > 0) { + if (shortname && shortname->length() > 0) { waypoint->shortname = *shortname; } - if (description && (*description).length() > 0) { + if (description && description->length() > 0) { waypoint->description = *description; } - if (start_str && (*start_str).length() > 0) { + if (start_str && start_str->length() > 0) { gpsbabel::DateTime start = QDateTime::fromString(*start_str, Qt::ISODate); waypoint->SetCreationTime(start); } diff --git a/jeeps/gpsread.cc b/jeeps/gpsread.cc index 7dbeb76ec..512c647af 100644 --- a/jeeps/gpsread.cc +++ b/jeeps/gpsread.cc @@ -79,7 +79,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) const char* m1; const char* m2; bool isDLE = false; - p = (*packet).data; + p = packet->data; start = GPS_Time_Now(); GPS_Diag("Rx Data:"); @@ -105,7 +105,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) } if (len == 1) { - (*packet).type = u; + packet->type = u; ++len; continue; } @@ -119,14 +119,14 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) } if (len == 2) { - (*packet).n = u; + packet->n = u; len = -1; continue; } if (u == ETX) if (isDLE) { - if (p - (*packet).data - 2 != (*packet).n) { + if (p - packet->data - 2 != packet->n) { GPS_Error("GPS_Packet_Read: Bad count"); gps_errno = FRAMING_ERROR; return 0; @@ -134,7 +134,7 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) chk_read = *(p - 2); unsigned int i; - for (i = 0, p = (*packet).data; i < (*packet).n; ++i) { + for (i = 0, p = packet->data; i < packet->n; ++i) { chk -= *p++; } chk -= packet->type; @@ -145,17 +145,17 @@ int32 GPS_Serial_Packet_Read(gpsdevh* fd, GPS_PPacket* packet) return 0; } - m1 = Get_Pkt_Type((*packet).type, (*packet).data[0], &m2); + m1 = Get_Pkt_Type(packet->type, packet->data[0], &m2); if (gps_show_bytes) { GPS_Diag(" "); for (unsigned j = 0; j < packet->n; j++) { - char c = (*packet).data[j]; + char c = packet->data[j]; GPS_Diag("%c", isascii(c) && isalnum(c) ? c : '.'); } GPS_Diag(" "); } GPS_Diag("(%-8s%s)\n", m1, m2 ? m2 : ""); - return (*packet).n; + return packet->n; } if (p - packet->data >= MAX_GPS_PACKET_SIZE) { @@ -193,12 +193,12 @@ bool GPS_Serial_Get_Ack(gpsdevh *fd, GPS_PPacket *tra, GPS_PPacket *rec) return false; } - if (LINK_ID[0].Pid_Ack_Byte != (*rec).type) { + if (LINK_ID[0].Pid_Ack_Byte != rec->type) { gps_error = FRAMING_ERROR; /* rjl return 0; */ } - if (*(*rec).data != (*tra).type) { + if (*rec->data != tra->type) { gps_error = FRAMING_ERROR; return false; } -- 2.30.2